#pragma once

#include <QtWidgets/QDialog>
#include "ui_videocapture.h"
#include "camera_config.h"
#include "cydevice.h"

class VideoCapture : public QDialog
{
    Q_OBJECT

public:
    VideoCapture(QWidget *parent = Q_NULLPTR);
    ~VideoCapture();
    void openCamera();
    void closeCamera();
    void receive();

    void changeResolution(int index);

signals:
    void setResolution(int width);

private:
    void initDialog();
    void initCamera();
	
    Ui::VideoCaptureClass ui{};
    Camera::Config cameraConfig;
    Camera::Command cameraCommand;
	CyDevice cameraDevice;
    QThread cameraThread;

    bool isOpen;
    bool isColor;

	QTimer timer;
	int frames;
};
